home *** CD-ROM | disk | FTP | other *** search
- Path: bmtlh10.bnr.ca!news
- From: John Hickin <hickin@bnr.ca>
- Newsgroups: comp.lang.c++
- Subject: Re: Convert string to char*
- Date: 16 Feb 1996 16:55:08 GMT
- Organization: Bell-Northern Research
- Message-ID: <4g2ctc$o6@bmtlh10.bnr.ca>
- References: <4g1ojq$r4r@lal.interserv.net>
- NNTP-Posting-Host: bmtlh520.bnr.ca
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (X11; I; HP-UX A.09.05 9000/715)
- X-URL: news:4g1ojq$r4r@lal.interserv.net
-
- dvisage@interserv.com wrote:
- P.S - This is the reason that the ANSI string class requires you to call
- the member function data() to get the chararacter string pointer
- of a string data type. It used to be called c_str().
-
- c_str() is still available, at least in the Jan 1996 DWP
- http://www.cygnus.com/misc/wp/jan96/
-
- The difference between data() and c_str() is that data() returns a pointer to
- the first charT of the string which may not have a traits::eos() at the end
- while c_str() guarantees that this termination charT is there. The wording of
- the DWP for data() is very carefully done so as to avoid unduely constraining
- the implementation. I would suggest to use c_str() unless you really know what
- you are doing.
-
- --
- John Hickin Nortel Technology, Montreal, Quebec
- (514) 765-7924 hickin@bnr.ca
-
-